<template>
  <a-modal :visible="visible" title="生产单" :footer="null" @cancel="visible = false" width="50%">
    <div class="orders">
      <div class="orders_item" v-for="(item,index) in orders" :key="index">
        <span class="item" v-for="(i,inx) in item" :key="inx">{{ i }}</span>
      </div>
    </div>
  </a-modal>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      orders: []
    }
  },
  methods: {
    init(data) {
      this.visible = true
      this.orders = this.sliceArray(data.expectUseInventoryScOrderNumber.split(','))
      console.log(this.orders);

    },
    sliceArray(originalArray, chunkSize = 5) {
      const groupedArrays = [];
      for (let i = 0; i < originalArray.length; i += chunkSize) {
        const chunk = originalArray.slice(i, i + chunkSize);
        groupedArrays.push(chunk);
      }
      return groupedArrays;
    }
  }
}
</script>

<style scoped>
  .orders_item{
    display: flex;
    align-items: center;
  }
  .item{
		margin: 5px 0px;
    display: block;
    width: calc((100 / 5)*1%);
    text-align: center;
  }
</style>